package com.qqt.csr.im.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @Author: yang hao
 * @Date: 2025/1/14 15:50
 * @Description: 启用状态
 **/
@Getter
@AllArgsConstructor
public enum EnableEnum {

    DISABLE(0, "禁用"),
    ENABLE(1, "启用"),

    ;

    private final Integer code;

    private final String desc;

    /**
     * 根据状态码获取启用状态
     * @param code 状态码
     * @return 启用状态
     */
    public static EnableEnum match(Integer code) {
        return Arrays.stream(EnableEnum.values())
                .filter(e -> e.getCode().equals(code))
                .findFirst()
                .orElse(null);
    }

}
